8d2e52774a0f26069d7dccd9d5ac4790968e04c2,src/edu/stanford/rsl/conrad/opencl/OpenCLForwardProjector.java,OpenCLForwardProjector,prepareAllProjections,#,384
Before Change
protected void prepareAllProjections(){
float [] cann = new float[3*4];
float [] invAR = new float[3*3];
float [] srcP = new float[3];
if (gInvARmatrix == null)
gInvARmatrix = context.createFloatBuffer(invAR.length*geometry.getNumProjectionMatrices(), Mem.READ_ONLY);
if (gSrcPoint == null)
gSrcPoint = context.createFloatBuffer(srcP.length*geometry.getNumProjectionMatrices(), Mem.READ_ONLY);
for (int i=0; i < geometry.getNumProjectionMatrices(); ++i){
SimpleMatrix projMat = geometry.getProjectionMatrix(i).computeP();
double [][] mat = new double [3][4];
projMat.copyTo(mat);
computeCanonicalProjectionMatrix(cann, invAR, srcP, new Jama.Matrix(mat));
gInvARmatrix.getBuffer().put(invAR);
gSrcPoint.getBuffer().put(srcP);
}
gInvARmatrix.getBuffer().rewind();
After Change
if (gInvARmatrix == null)
gInvARmatrix = context.createFloatBuffer(3*3*nrProj, Mem.READ_ONLY);
if (gSrcPoint == null)
gSrcPoint = context.createFloatBuffer(3*nrProj, Mem.READ_ONLY);
gInvARmatrix.getBuffer().rewind();
gSrcPoint.getBuffer().rewind();
for (int i=0; i < nrProj; ++i){
computeCanonicalProjectionMatrix(gInvARmatrix, gSrcPoint, projectionMatrices[i]);
}
gInvARmatrix.getBuffer().rewind();
gSrcPoint.getBuffer().rewind();
commandQueue
.putWriteBuffer(gSrcPoint, true)